/*
 * Copyright (C) Michael Opitz
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA
 */
#ifndef TITLE_DATASET_H
#define TITLE_DATASET_H

#include "title_adapter.h"
#include <iostream>
#include <list>

using namespace std;

/** 
 * \brief This namespace includes all music-related stuff.
 * \author Michael Opitz
 */
namespace music {
	/** 
	 * \brief This class represents a data-set with title-objects for the
	 * apriori algorithm.
	 */
	class title_dataset {
	public:
		typedef boost::shared_ptr<music::title_dataset> ptr;
		typedef music::title_adapter data;
		typedef boost::shared_ptr<music::title_adapter> data_ptr;
		typedef list<data> data_collection;
		typedef list<data_ptr> data_coll;

		title_dataset() {}
		~title_dataset() {}

		/** 
		 * \brief get_elements returns a list of shared_ptrs to
		 * title_adapter objects
		 */
		data_coll& get_elements() { return _coll; }
		/** 
		 * \brief push_back adds a new shared_ptr to a title_adapter to
		 * the dataset
		 */
		void push_back(data_ptr p) { _coll.push_back(p); }
		/** 
		 * \brief empty returns true if the dataset is empty
		 */
		bool empty() const { return _coll.empty(); }
		/** 
		 * \brief print prints the dataset. For debug purposes only
		 */
		void print() const
		{
			typedef data_coll::const_iterator it;
			for(it i = _coll.begin(); i != _coll.end(); ++i) {
				(*i)->get()->print();
			}
		}
	private:
		data_coll _coll;
	};
}

ostream& operator << (ostream &rhs, music::title_dataset &set);

#endif

